package com.qgs.waf.echarts;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import org.springframework.data.redis.core.ZSetOperations.TypedTuple;

import com.github.abel533.echarts.data.PieData;

@SuppressWarnings({ "rawtypes", "unchecked" })
public class ECharts {
	public static List<PieData> tupleSets2List(Set<TypedTuple> tuples, String[] datas) {
		List<PieData> list = new ArrayList<PieData>();
		if (null != tuples) {
			for (TypedTuple<String> tuple : tuples) {
				list.add(new PieData(tuple.getValue().toString(), tuple.getScore()));
			}
		} else {
			for (String data : datas) {
				list.add(new PieData(data, 0));
			}
		}
		return list;
	}
}
